# Maintainer: Frederik Schwan <freswa at archlinux dot org>
# Contributor: DonVla <donvla@users.sourceforge.net>
# Contributor: achterin <headlock@its-crap.de>

pkgname=perl-mail-imapclient
pkgver=3.43
pkgrel=4
pkgdesc='Perl/CPAN Module Mail::IMAPClient : An IMAP Client API'
arch=('any')
url='https://search.cpan.org/dist/Mail-IMAPClient'
license=('GPL')
depends=('perl-parse-recdescent' 'perl-digest-hmac')
optdepends=("perl-authen-sasl: for Authmechanism 'DIGEST-MD5'")
options=('!emptydirs' purge)
source=("https://cpan.metacpan.org/authors/id/P/PL/PLOBBES/Mail-IMAPClient-${pkgver}.tar.gz")
b2sums=('da28ec4358532dcac59241dca4ffc29c3cf86bc3bba388dd66e27f45ac675c4754d0def00eb7112e4b1ffb1d595b3941b160a3f3e81a8ffccacc8351b4f96a94')

build() {
  cd Mail-IMAPClient-${pkgver}
  unset PERL5LIB PERL_MM_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps
  /usr/bin/perl Makefile.PL
  make
}

check() {
  cd Mail-IMAPClient-${pkgver}
  unset PERL5LIB PERL_MM_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1
  make test
}

package() {
  cd Mail-IMAPClient-${pkgver}
  unset PERL5LIB PERL_MM_OPT PERL_LOCAL_LIB_ROOT
  make install INSTALLDIRS=vendor DESTDIR="${pkgdir}"
}
